package mobi.hami.huapin.dao;

import java.util.Map;

public class UserReturnGoodsLogProvider {
    public  String  selectWitchParam(Map<String,Object> parms){
        StringBuilder sb = new StringBuilder();
        sb.append("select * from user_returngoods_log where ");
        if(null != parms && !parms.isEmpty()){
           if(null != parms.get("user_id") && !parms.get("user_id").equals("")){
               sb.append("user_id = ").append(parms.get("user_id")).append(" and ");
           }
           if(null != parms.get("order_id") && !parms.get("order_id").equals("")){
              sb.append("order_id = ").append(new Integer(String.valueOf(parms.get("order_id")))).append(" and ");
           }
           if(null != parms.get("courier_code") && !parms.get("courier_code").equals("")){
                sb.append("courier_code = '").append(String.valueOf(parms.get("courier_code"))).append("'").append(" and ");
            }
            if(null != parms.get("open_id") && !parms.get("open_id").equals("")){
                sb.append("open_id = '").append(String.valueOf(parms.get("open_id"))).append("'").append(" and ");
            }
            if(null != parms.get("contact_name") && !parms.get("contact_name").equals("")){
                sb.append("contact_name like '%").append(String.valueOf(parms.get("contact_name"))).append("%'").append(" and ");
            }
            if(null != parms.get("contact_mobile") && !parms.get("contact_mobile").equals("")){
                sb.append("contact_mobile like '%").append(String.valueOf(parms.get("contact_mobile"))).append("%'").append(" and ");
            }
        }
        sb.append("1 = 1 ");
        sb.append("order by create_time desc");
        System.out.println(sb.toString());
        return sb.toString();
    }


}
